package com.lbw.singleton;

/**
 * @author lbw
 * @version 1.0
 * @date 2021/9/4 22:54
 * 静态内部类实现单例模式, 依靠jvm的类加载机制保证线程安全
 */
public class Singleton5 {

    private Singleton5() {
    }

    private static class InnerClass {
        private final static Singleton5 INSTANCE = new Singleton5();
    }

    public static Singleton5 getInstance() {
        return InnerClass.INSTANCE;
    }
}
